import { getAreaObj, uploadType, regularRule } from '@/utils/util'
import { configToSearch, toSearchHandle } from '@/views/datacenter/business/utils/index'

// const stateDicData = [
// 	{ label: '未完成', value: '0', type: 'danger' },
// 	{ label: '进行中', value: '1', type: 'info' },
// 	{ label: '已完成', value: '2', type: 'success' },
// ]
export const detailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	column: [
		{
			type: 'DividerHtml',
			modelValue: '用户信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '用户姓名',
			tmaxlength: '20',
			showWordLimit: true,
			type: 'text',
			prop: 'name',
			span: 8,
			rules: [{ required: true, message: '请输入用户姓名' }],
		},
		{
			label: '用户性别',
			prop: 'gender',
			propName: 'genderLabel',
			type: 'remoteSelect',
			pai: 'getDictItemList',
			code: 'GENDER',
			span: 8,
		},
		{
			label: '用户年龄',
			prop: 'age',
			span: 8,
			rules: [{ required: true, message: '请输入用户年龄' }],
		},
		{
			label: '证件号码',
			prop: 'idCard',
			type: 'input',
			span: 8,
			changeField: true,
			rules: [{ required: true, message: '请输入证件号码' }],
		},
		{
			label: '联系电话',
			prop: 'phone',
			type: 'input',
			rules: [
				{ required: true, message: '请输入联系电话' },
				{ pattern: regularRule.phone, message: '请输入正确的联系电话' },
			],
			span: 8,
		},
		{
			label: '能力等级',
			prop: 'abilityLevel',
			propName: 'abilityLevelLabel',
			type: 'remoteSelect',
			code: 'ACCESS_LEVEL_COUNTRY',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请输入能力等级' }],
		},
		{
			label: '用户类别',
			prop: 'category',
			propName: 'categoryLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请输入用户类别' }],
		},
		{
			label: '经济困难',
			prop: 'economicHardship',
			propName: 'economicHardshipLabel',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 8,
		},
		{
			label: '户籍区划',
			prop: 'cr_areas',
			propName: 'cr_areas_name',
			type: 'AplidAreaSelect',
			changeField: true,
			rules: [{ required: true, message: '请选择户籍区划' }],
			span: 8,
		},
		{
			label: '户籍地址',
			prop: 'crAddress',
			maxlength: '140',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			span: 8,
		},
		{
			label: '改造地区',
			prop: 'areas',
			propName: 'areas_name',
			type: 'AplidAreaSelect',
			changeField: true,
			rules: [{ required: true, message: '请选择改造地区' }],
			span: 8,
		},
		{
			label: '改造地址',
			prop: 'address',
			maxlength: '140',
			showWordLimit: true,
			changeField: true,
			type: 'text',
			rules: [{ required: true, message: '请输入改造地址' }],
			span: 8,
		},
		{
			label: '既往是否已实施适老化',
			prop: 'isImplement',
			propName: 'isImplementLabel',
			code: 'COMMON_FLAG',
			type: 'remoteSelect',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '既往补助金额',
			prop: 'subsidyAmount',
			type: 'input',
			append: '元',
			rules: [{ pattern: regularRule.fixedTwoNum, message: '请输入正确的金额' }],
			span: 8,
		},
		{
			label: '联系人姓名',
			prop: 'contactName',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入联系人姓名' }],
		},
		{
			label: '联系方式',
			prop: 'contactPhone',
			maxlength: '11',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入联系方式' }],
		},
		{
			label: '与用户关系',
			prop: 'relationship',
			propName: 'relationshipLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_RELATIONSHIP',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 8,
			rules: [{ required: true, message: '请选择与用户关系' }],
		},

		{
			type: 'DividerHtml',
			modelValue: '既往补助信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '改造实际金额',
			prop: 'actualAmount',
			type: 'input',
			append: '元',
			rules: [
				{ required: true, message: '请输入改造实际金额' },
				{ pattern: regularRule.fixedTwoNum, message: '请输入正确的金额' },
			],
			span: 8,
		},
		{
			label: '改造标准金额',
			prop: 'standardAmount',
			type: 'input',
			append: '元',
			rules: [
				{ required: true, message: '请输入改造标准金额' },
				{ pattern: regularRule.fixedTwoNum, message: '请输入正确的金额' },
			],
			span: 8,
		},
		{
			label: '改造汇总表',
			prop: 'summary',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
		},
	],
}

// 申请档案详情
export const applyDetailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	column: [
		{
			type: 'DividerHtml',
			modelValue: '档案信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '申请类型',
			prop: 'type',
			propName: 'typeLabel',
			span: 8,
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'APPLY_TYPE',
		},
		{
			label: '房产所有人',
			prop: 'propertyOwner',
			span: 8,
		},
		{
			label: '居住人数',
			prop: 'liveNumber',
			span: 8,
		},
		{
			label: '建筑面积',
			prop: 'buildingArea',
			span: 8,
		},
		{
			label: '房屋类型',
			prop: 'houseTypeLabel',
			span: 8,
		},
		{
			label: '建成时间',
			prop: 'buildDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
		},
		{
			label: '适老化人员类别',
			prop: 'elderlyRemouldPersonType',
			span: 8,
			propName: 'elderlyRemouldPersonTypeLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_REMOULD_PERSON_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
		},
		{
			label: '政府养老扶助对象类别',
			prop: 'elderlyType',
			span: 8,
			propName: 'elderlyTypeLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
		},
		{
			label: '户型',
			prop: 'doorModel',
			span: 8,
		},
		{
			label: '改造需求',
			prop: 'reconstructionDemand',
			span: 8,
			propName: 'reconstructionDemandLabel',
			type: 'remoteSelect',
			code: 'RECONSTRUCTION_DEMAND',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: true,
		},

		{
			type: 'DividerHtml',
			modelValue: '申请信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '申请时间',
			prop: 'time',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
			rules: [{ required: true, message: '请选择申请时间' }],
		},
		{
			label: '受理单位名称',
			prop: 'applyUnitName',
			type: 'text',
			maxlength: '50',
			showWordLimit: true,
			span: 8,
			rules: [{ required: true, message: '请输入申请受理单位名称' }],
		},
		{
			label: '申请档案状态',
			prop: 'applyState',
			propName: 'applyStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
			span: 8,
			defaultValue: 0,
			rules: [{ required: true, message: '请选择申请档案状态' }],
		},
		{
			label: '受理人姓名',
			prop: 'acceptName',
			span: 8,
			type: 'text',
			maxlength: '20',
			showWordLimit: true,
			rules: [{ required: true, message: '请输入申请受理人姓名' }],
		},
		{
			label: '受理时间',
			prop: 'acceptTime',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
			rules: [{ required: true, message: '请选择申请受理时间' }],
		},
		{
			label: '申请结果',
			prop: 'applyResult',
			propName: 'applyResultLabel',
			type: 'remoteSelect',
			code: 'RESULT',
			api: 'getDictItemList',
			span: 8,
			rules: [{ required: true, message: '请选择申请结果' }],
		},
		{
			label: '附件',
			prop: 'applyAttachment',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请上传申请表附件' }],
		},
	],
}
// 评估档案详情
export const accessDetailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	column: [
		{
			type: 'DividerHtml',
			modelValue: '评估信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '评估单位名称',
			prop: 'assessUnitName',
			span: 8,
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			rules: [{ required: true, message: '请输入评估单位名称' }],
		},
		{
			label: '单位统一信用代码',
			prop: 'creditCode',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '评估人姓名',
			prop: 'assessName',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入评估人姓名' }],
		},
		{
			label: '评估日期',
			prop: 'assessDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
			rules: [{ required: true, message: '请选择评估日期' }],
		},
		{
			label: '评估档案状态',
			prop: 'assessState',
			propName: 'assessStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
			span: 8,
			defaultValue: 0,
			rules: [{ required: true, message: '请选择评估档案状态' }],
		},
		{
			label: '评估结果',
			prop: 'assessResult',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请选择评估结果' }],
		},
		{
			label: '附件',
			prop: 'assessAttachment',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请选择评估表附件' }],
		},
	],
}
// 改造档案详情
export const reformDetailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	column: [
		{
			type: 'DividerHtml',
			modelValue: '改造信息',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '改造单位名称',
			prop: 'remouldUnitName',
			span: 8,
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			rules: [{ required: true, message: '请输入改造单位名称' }],
		},
		{
			label: '单位统一信用代码',
			prop: 'remouldCreditCode',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '改造人姓名',
			prop: 'remouldName',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入改造人姓名' }],
		},
		{
			label: '改造日期',
			prop: 'remouldDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
		},
		{
			label: '改造档案状态',
			prop: 'remouldState',
			propName: 'remouldStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
			span: 8,
			defaultValue: 0,
			rules: [{ required: true, message: '请选择改造档案状态' }],
		},
		{
			label: '改造结果',
			prop: 'remouldResult',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入改造结果' }],
		},
		{
			type: 'DividerHtml',
			modelValue: '附件',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '改造表附件',
			prop: 'remouldAttachment',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请选择改造表附件' }],
		},
		{
			label: '施工照片',
			prop: 'constructionImg',
			type: 'upload',
			showFileList: true,
			limit: 9,
			multiple: true,
			custome: 'img',
			listType: 'picture-card',
			span: 24,
		},
		// {
		// 	type: 'DividerHtml',
		// 	modelValue: '改造前后对比',
		// 	labelPosition: 'top',
		// 	span: 24,
		// },
		// {
		// 	label: '基础类项目',
		// 	type: 'dynamic',
		// 	prop: 'dp_foundation_social_title',
		// 	span: 24,
		// 	tabType: 'table',
		// 	custome: 'table',
		// 	labelPosition: 'top',
		// 	column: [
		// 		{
		// 			label: '改造项目',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '安装位置',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '改造个数',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '改造前照片',
		// 			uploadTip: '照片',
		// 			prop: 'photo',
		// 			type: 'upload',
		// 			labelPosition: 'top',
		// 			custome: 'file',
		// 			showFileList: false,
		// 			limit: 1,
		// 			multiple: false,
		// 			changeField: false,
		// 			span: 24,
		// 		},
		// 		{
		// 			label: '改造后照片',
		// 			uploadTip: '照片',
		// 			prop: 'photo',
		// 			type: 'upload',
		// 			labelPosition: 'top',
		// 			custome: 'file',
		// 			showFileList: false,
		// 			limit: 1,
		// 			multiple: false,
		// 			changeField: false,
		// 			span: 24,
		// 		},
		// 	],
		// },
		// {
		// 	label: '可选类项目',
		// 	type: 'dynamic',
		// 	prop: 'dp_foundation_social_title',
		// 	span: 24,
		// 	tabType: 'table',
		// 	custome: 'table',
		// 	labelPosition: 'top',
		// 	column: [
		// 		{
		// 			label: '改造项目',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '安装位置',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '改造个数',
		// 			prop: 'jobTypeLabel',
		// 			type: 'input',
		// 			span: 8,
		// 		},
		// 		{
		// 			label: '改造前照片',
		// 			uploadTip: '照片',
		// 			prop: 'photo',
		// 			type: 'upload',
		// 			labelPosition: 'top',
		// 			custome: 'file',
		// 			showFileList: false,
		// 			limit: 1,
		// 			multiple: false,
		// 			changeField: false,
		// 			span: 24,
		// 		},
		// 		{
		// 			label: '改造后照片',
		// 			uploadTip: '照片',
		// 			prop: 'photo',
		// 			type: 'upload',
		// 			labelPosition: 'top',
		// 			custome: 'file',
		// 			showFileList: false,
		// 			limit: 1,
		// 			multiple: false,
		// 			changeField: false,
		// 			span: 24,
		// 		},
		// 	],
		// },
	],
}
// 验收档案详情
export const acceptDetailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '180px',
	column: [
		{
			type: 'DividerHtml',
			modelValue: '适老化改造验收',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '验收单位名称',
			prop: 'acceptanceUnitName',
			span: 8,
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			rules: [{ required: true, message: '请输入验收单位名称' }],
		},
		{
			label: '单位统一信用代码',
			prop: 'acceptanceCreditCode',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入单位统一信用代码' }],
		},
		{
			label: '验收人姓名',
			prop: 'acceptanceName',
			maxlength: '20',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入验收人姓名' }],
		},
		{
			label: '验收日期',
			prop: 'acceptanceDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			span: 8,
			rules: [{ required: true, message: '请输入验收日期' }],
		},
		{
			label: '验收结果',
			prop: 'acceptanceResult',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
			rules: [{ required: true, message: '请输入验收结果' }],
		},
		{
			label: '验收档案状态',
			prop: 'acceptanceState',
			propName: 'acceptanceStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
			span: 8,
			defaultValue: 0,
			rules: [{ required: true, message: '请选择验收档案状态' }],
		},
		{
			label: '验收表附件',
			prop: 'acceptanceAttachment',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请选择验收表附件' }],
		},
	],
}
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{ label: '所属区', prop: 'crAreaName' },
		{ label: '姓名', prop: 'name' },
		{ label: '证件号码', prop: 'idCard', plusXing: '2,2' },
		{ label: '联系方式', prop: 'phone', plusXing: '5,2' },
		{
			label: '经济困难',
			prop: 'economicHardshipLabel',
		},
		{
			label: '类别',
			prop: 'categoryLabel',
		},
		{
			label: '申请档案',
			prop: 'applyState',
			propName: 'applyStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
		},
		{
			label: '评估档案',
			prop: 'assessState',
			propName: 'assessStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
		},
		{
			label: '改造档案',
			prop: 'remouldState',
			propName: 'remouldStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
		},
		{
			label: '验收档案',
			prop: 'acceptanceState',
			propName: 'acceptanceStateLabel',
			type: 'remoteSelect',
			api: 'getDictItemList',
			code: 'ARCHIVES_STATUS',
		},
		{
			label: '是否可信',
			prop: 'isBelievable',
			custome: 'tag',
			dicData: [
				{ label: '否', value: 0, type: 'danger' },
				{ label: '是', value: 1, type: 'success' },
			],
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: [
		...detailConfig.column.filter((item) => !['age', 'gender'].includes(item.prop)),
		...applyDetailConfig.column,
		...accessDetailConfig.column,
		...reformDetailConfig.column,
		...acceptDetailConfig.column,
	],
}
const moreSearchConfig: any = {
	inline: true,
	showBtn: false,
	labelPosition: 'left',
	column: [...configToSearch(formConfig.column)],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '证件号码',
			prop: 'idCard',
			type: 'input',
			span: 6,
		},
		{
			label: '姓名',
			prop: 'name',
			type: 'input',
			span: 6,
		},
		{
			label: '联系方式',
			prop: 'phone',
			type: 'input',
			span: 6,
		},
		{
			label: '户籍区域',
			propName: 'cr_areas_name',
			type: 'AplidAreaSelect',
			span: 6,
		},
		{
			label: '经济困难',
			prop: 'economicHardship',
			type: 'remoteSelect',
			code: 'COMMON_FLAG',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 6,
		},
		{
			label: '类别',
			prop: 'category',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			filterKey: 'value',
			multiple: false,
			span: 6,
		},
		{
			label: '能力等级',
			prop: 'abilityLevel',
			type: 'remoteSelect',
			code: 'ACCESS_LEVEL_COUNTRY',
			api: 'getDictItemList',
			filterKey: 'value',
			changeField: true,
			multiple: false,
			span: 6,
		},
		{
			label: '是否完成',
			prop: 'isComplete',
			propName: 'isCompleteLabel',
			type: 'select',
			dicData: [
				{ label: '否', value: 0, type: 'danger' },
				{ label: '是', value: 1, type: 'success' },
			],
			span: 6,
		},
	],
}

export const baseConfig: any = {
	pageName: '适老化改造档案',
	dictcodes: [
		'HOUSE_TYPE',
		'ELDERLY_REMOULD_PERSON_TYPE',
		'RECONSTRUCTION_DEMAND',
		'ELDERLY_TYPE',
		'GENDER',
		'ACCESS_LEVEL_COUNTRY',
		'ARCHIVES_STATUS',
		'APPLY_TYPE',
		'RESULT',
		'COMMON_FLAG',
	],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'name',
	exportMqTopic: '/ning/export/',
	api: {
		moreSearch: 'view_dpElderlyRemould_search',
		index: 'view_dpElderlyRemould_page',
		add: 'view_dpElderlyRemould_add',
		edit: 'view_dpElderlyRemould_edit',
		delete: 'view_dpElderlyRemould_del',
		export: 'view_dpElderlyRemould_export',
		import: 'view_dpElderlyRemould_import',
		detail: 'view_dpElderlyRemould_view',
	},
	auth: {
		index: 'view_dpElderlyRemould_page',
		add: 'view_dpElderlyRemould_add',
		edit: 'view_dpElderlyRemould_edit',
		delete: 'view_dpElderlyRemould_del',
		export: 'view_dpElderlyRemould_export',
		import: 'view_dpElderlyRemould_import',
		detail: 'view_dpElderlyRemould_view',
		mulitSet: 'mulitSet',
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '查看档案',
			type: 'primary',
			operate: 'Archives',
			auth: 'view_dpElderlyRemould_page',
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: 'view_dpElderlyRemould_del',
			text: true,
			show: true,
		},
		{
			icon: 'editor',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: 'view_dpElderlyRemould_edit',
			text: true,
			show: true,
		},
	],
	paramsObj: {
		code: 2018,
	},
	dialogConfig: {
		width: '85%',
	},
	moreSearchConfig,
	searchConfig,
	formConfig,
	tableConfig,
	beforeOnLoadFormate: async (query) => {
		query = toSearchHandle(moreSearchConfig, {}, query)
		return new Promise((resolve, reject) => {
			const crAreasObj: any = getAreaObj(query.cr_areas_name, 'cr')
			resolve({
				...query,
				...crAreasObj,
				cr_areas_name: undefined,
			})
		})
	},
	operateFormate: async (row) => {
		return new Promise((resolve, reject) => {
			const crAreas: any = getAreaObj(row, 'cr', 'get')
			const areas: any = getAreaObj(row, '', 'get')

			resolve({
				...row,
				cr_areas_name: crAreas.names,
				cr_areas: crAreas.areaIds,
				areas: areas.areaIds,
				areas_name: areas.names,
			})
		})
	},
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			const crAreas: any = getAreaObj(item, 'cr', 'get')
			const areas: any = getAreaObj(item, '', 'get')

			return {
				...item,
				cr_areas_name: crAreas.names,
				cr_areas: crAreas.areaIds,
				areas: areas.areaIds,
				areas_name: areas.names,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
	saveFormate: async (form) => {
		return new Promise((resolve, reject) => {
			const areaObj: any = getAreaObj(form.areas)
			const areaNameObj: any = getAreaObj(form.areas_name)

			const crAreasObj: any = getAreaObj(form.cr_areas, 'cr')
			const crAreasNameObj: any = getAreaObj(form.cr_areas_name, 'cr')
			resolve({
				...form,
				...areaObj,
				...areaNameObj,
				...crAreasObj,
				...crAreasNameObj,
				cr_areas_name: undefined,
				cr_areas: undefined,
				areas: undefined,
				areas_name: undefined,
			})
		})
	},
}
